package ooo.reindeer.data.util;

/**
 * @ClassName UnitVarUtil
 * @Author songbailin
 * @Date 2022/8/26 17:11
 * @Version 1.0
 * @Description TODO
 */
public class UnitVarUtil {



    public static int getUintVarSize(long value) {
        if (value < 0) {
            throw new IllegalArgumentException("value must be positive");
        }
        if (value < 0x80) {
            return 1;
        } else if (value < 0x4000) {
            return 2;
        } else if (value < 0x200000) {
            return 3;
        } else if (value < 0x10000000) {
            return 4;
        } else {
            return 5;
        }
    }
}
